package priv.mill.controller;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("hello")
public class HelloController {

	private static final Logger logger = Logger
			.getLogger(HelloController.class);
	
	@RequestMapping("world")
	public String helloFirst() {
		return "hello/success";
	}
	
	/**
	 * 该方法只在post请求的时候才有效
	 * get请求的时候会抛出Request method 'GET' not supported异常
	 * @return
	 */
	@RequestMapping(value="testPost",method=RequestMethod.POST)
	public String testPost() {
		return "hello/success";
	}
	
	@RequestMapping(value="testParam",params={"name","age!=10"})
	public String testParam() {
		return "hello/success";
	}
	@RequestMapping(value="testheaders",headers={"Accept-Encoding=gzip, deflate, br"})
	public String testheaders() {
		return "hello/success";
	}
	@RequestMapping(value="testant/*/mi??")
	public String testant() {
		return "hello/success";
	}
	@RequestMapping(value="tesPathVariable/{name}/{age}")
	public String tesPathVariable(
			@PathVariable("name") String name
			,@PathVariable("age") int age) {
		System.out.println(name+":"+age);
		return "hello/success";
	}
}
